3.120 \(\int \frac{\cos ^2(c+d x)}{(a+i a \tan (c+d x))^2} \, dx\)

Optimal. Leaf size=114 \[ -\frac{i}{16 d \left (a^2-i a^2 \tan (c+d x)\right )}+\frac{3 i}{16 d \left (a^2+i a^2 \tan (c+d x)\right )}+\frac{x}{4 a^2}+\frac{i a}{12 d (a+i a \tan (c+d x))^3}+\frac{i}{8 d (a+i a \tan (c+d x))^2} \]

[Out]

x/(4*a^2) + ((I/12)*a)/(d*(a + I*a*Tan[c + d*x])^3) + (I/8)/(d*(a + I*a*Tan[c + d*x])^2) - (I/16)/(d*(a^2 - I*
a^2*Tan[c + d*x])) + ((3*I)/16)/(d*(a^2 + I*a^2*Tan[c + d*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.0814118, antiderivative size = 114, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 24, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.125, Rules used = {3487, 44, 206} \[ -\frac{i}{16 d \left (a^2-i a^2 \tan (c+d x)\right )}+\frac{3 i}{16 d \left (a^2+i a^2 \tan (c+d x)\right )}+\frac{x}{4 a^2}+\frac{i a}{12 d (a+i a \tan (c+d x))^3}+\frac{i}{8 d (a+i a \tan (c+d x))^2} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2/(a + I*a*Tan[c + d*x])^2,x]

[Out]

x/(4*a^2) + ((I/12)*a)/(d*(a + I*a*Tan[c + d*x])^3) + (I/8)/(d*(a + I*a*Tan[c + d*x])^2) - (I/16)/(d*(a^2 - I*
a^2*Tan[c + d*x])) + ((3*I)/16)/(d*(a^2 + I*a^2*Tan[c + d*x]))

Rule 3487

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rule 44

Int[((a_) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d*
x)^n, x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && ILtQ[m, 0] && IntegerQ[n] &&  !(IGtQ[n, 0] && L
tQ[m + n + 2, 0])

Rule 206

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTanh[(Rt[-b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[-b, 2]), x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{\cos ^2(c+d x)}{(a+i a \tan (c+d x))^2} \, dx &=-\frac{\left (i a^3\right ) \operatorname{Subst}\left (\int \frac{1}{(a-x)^2 (a+x)^4} \, dx,x,i a \tan (c+d x)\right )}{d}\\ &=-\frac{\left (i a^3\right ) \operatorname{Subst}\left (\int \left (\frac{1}{16 a^4 (a-x)^2}+\frac{1}{4 a^2 (a+x)^4}+\frac{1}{4 a^3 (a+x)^3}+\frac{3}{16 a^4 (a+x)^2}+\frac{1}{4 a^4 \left (a^2-x^2\right )}\right ) \, dx,x,i a \tan (c+d x)\right )}{d}\\ &=\frac{i a}{12 d (a+i a \tan (c+d x))^3}+\frac{i}{8 d (a+i a \tan (c+d x))^2}-\frac{i}{16 d \left (a^2-i a^2 \tan (c+d x)\right )}+\frac{3 i}{16 d \left (a^2+i a^2 \tan (c+d x)\right )}-\frac{i \operatorname{Subst}\left (\int \frac{1}{a^2-x^2} \, dx,x,i a \tan (c+d x)\right )}{4 a d}\\ &=\frac{x}{4 a^2}+\frac{i a}{12 d (a+i a \tan (c+d x))^3}+\frac{i}{8 d (a+i a \tan (c+d x))^2}-\frac{i}{16 d \left (a^2-i a^2 \tan (c+d x)\right )}+\frac{3 i}{16 d \left (a^2+i a^2 \tan (c+d x)\right )}\\ \end{align*}

Mathematica [A]  time = 0.25752, size = 95, normalized size = 0.83 \[ \frac{i \sec ^2(c+d x) (-12 d x \sin (2 (c+d x))+3 i \sin (2 (c+d x))+2 i \sin (4 (c+d x))+(-3+12 i d x) \cos (2 (c+d x))+\cos (4 (c+d x))-9)}{48 a^2 d (\tan (c+d x)-i)^2} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2/(a + I*a*Tan[c + d*x])^2,x]

[Out]

((I/48)*Sec[c + d*x]^2*(-9 + (-3 + (12*I)*d*x)*Cos[2*(c + d*x)] + Cos[4*(c + d*x)] + (3*I)*Sin[2*(c + d*x)] -
12*d*x*Sin[2*(c + d*x)] + (2*I)*Sin[4*(c + d*x)]))/(a^2*d*(-I + Tan[c + d*x])^2)

________________________________________________________________________________________

Maple [A]  time = 0.093, size = 117, normalized size = 1. \begin{align*}{\frac{-{\frac{i}{8}}\ln \left ( \tan \left ( dx+c \right ) -i \right ) }{{a}^{2}d}}-{\frac{{\frac{i}{8}}}{{a}^{2}d \left ( \tan \left ( dx+c \right ) -i \right ) ^{2}}}-{\frac{1}{12\,{a}^{2}d \left ( \tan \left ( dx+c \right ) -i \right ) ^{3}}}+{\frac{3}{16\,{a}^{2}d \left ( \tan \left ( dx+c \right ) -i \right ) }}+{\frac{{\frac{i}{8}}\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{{a}^{2}d}}+{\frac{1}{16\,{a}^{2}d \left ( \tan \left ( dx+c \right ) +i \right ) }} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2/(a+I*a*tan(d*x+c))^2,x)

[Out]

-1/8*I/a^2/d*ln(tan(d*x+c)-I)-1/8*I/a^2/d/(tan(d*x+c)-I)^2-1/12/a^2/d/(tan(d*x+c)-I)^3+3/16/a^2/d/(tan(d*x+c)-
I)+1/8*I/a^2/d*ln(tan(d*x+c)+I)+1/16/a^2/d/(tan(d*x+c)+I)

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2/(a+I*a*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 2.24551, size = 198, normalized size = 1.74 \begin{align*} \frac{{\left (24 \, d x e^{\left (6 i \, d x + 6 i \, c\right )} - 3 i \, e^{\left (8 i \, d x + 8 i \, c\right )} + 18 i \, e^{\left (4 i \, d x + 4 i \, c\right )} + 6 i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i\right )} e^{\left (-6 i \, d x - 6 i \, c\right )}}{96 \, a^{2} d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2/(a+I*a*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

1/96*(24*d*x*e^(6*I*d*x + 6*I*c) - 3*I*e^(8*I*d*x + 8*I*c) + 18*I*e^(4*I*d*x + 4*I*c) + 6*I*e^(2*I*d*x + 2*I*c
) + I)*e^(-6*I*d*x - 6*I*c)/(a^2*d)

________________________________________________________________________________________

Sympy [A]  time = 0.680492, size = 190, normalized size = 1.67 \begin{align*} \begin{cases} \frac{\left (- 24576 i a^{6} d^{3} e^{14 i c} e^{2 i d x} + 147456 i a^{6} d^{3} e^{10 i c} e^{- 2 i d x} + 49152 i a^{6} d^{3} e^{8 i c} e^{- 4 i d x} + 8192 i a^{6} d^{3} e^{6 i c} e^{- 6 i d x}\right ) e^{- 12 i c}}{786432 a^{8} d^{4}} & \text{for}\: 786432 a^{8} d^{4} e^{12 i c} \neq 0 \\x \left (\frac{\left (e^{8 i c} + 4 e^{6 i c} + 6 e^{4 i c} + 4 e^{2 i c} + 1\right ) e^{- 6 i c}}{16 a^{2}} - \frac{1}{4 a^{2}}\right ) & \text{otherwise} \end{cases} + \frac{x}{4 a^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2/(a+I*a*tan(d*x+c))**2,x)

[Out]

Piecewise(((-24576*I*a**6*d**3*exp(14*I*c)*exp(2*I*d*x) + 147456*I*a**6*d**3*exp(10*I*c)*exp(-2*I*d*x) + 49152
*I*a**6*d**3*exp(8*I*c)*exp(-4*I*d*x) + 8192*I*a**6*d**3*exp(6*I*c)*exp(-6*I*d*x))*exp(-12*I*c)/(786432*a**8*d
**4), Ne(786432*a**8*d**4*exp(12*I*c), 0)), (x*((exp(8*I*c) + 4*exp(6*I*c) + 6*exp(4*I*c) + 4*exp(2*I*c) + 1)*
exp(-6*I*c)/(16*a**2) - 1/(4*a**2)), True)) + x/(4*a**2)

________________________________________________________________________________________

Giac [A]  time = 1.16101, size = 139, normalized size = 1.22 \begin{align*} -\frac{-\frac{6 i \, \log \left (\tan \left (d x + c\right ) + i\right )}{a^{2}} + \frac{6 i \, \log \left (\tan \left (d x + c\right ) - i\right )}{a^{2}} + \frac{3 \,{\left (2 i \, \tan \left (d x + c\right ) - 3\right )}}{a^{2}{\left (\tan \left (d x + c\right ) + i\right )}} + \frac{-11 i \, \tan \left (d x + c\right )^{3} - 42 \, \tan \left (d x + c\right )^{2} + 57 i \, \tan \left (d x + c\right ) + 30}{a^{2}{\left (\tan \left (d x + c\right ) - i\right )}^{3}}}{48 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2/(a+I*a*tan(d*x+c))^2,x, algorithm="giac")

[Out]

-1/48*(-6*I*log(tan(d*x + c) + I)/a^2 + 6*I*log(tan(d*x + c) - I)/a^2 + 3*(2*I*tan(d*x + c) - 3)/(a^2*(tan(d*x
 + c) + I)) + (-11*I*tan(d*x + c)^3 - 42*tan(d*x + c)^2 + 57*I*tan(d*x + c) + 30)/(a^2*(tan(d*x + c) - I)^3))/
d